<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Engine</title>
    <link
      rel="shortcut icon"
      type="image/x-icon"
      href="/examples/public/favicon.ico"
    />
    <link rel="stylesheet" href="../css/common.css" />
  </head>

  <style>
    #app {
      width: 100%;
      height: 100%;
    }
  </style>

  <body>
    <div id="app"></div>

    <script type="module">
      import * as THREE from "three";
      import * as Vis from "../../dist/Vis.es.js";

      const engine = new Vis.Engine()
        .install("WebGLRenderer", {
          antialias: true,
          alpha: true,
        })
        .install("RenderManager")
        .install("Stats")
        .install("EffectComposer", {
          WebGLMultisampleRenderTarget: true,
        })
        .install("OrbitControls")
        .install("PointerManager")
        .install("EventManager")
        .install("TransformControls")
        .complete()
        .setDom(document.getElementById("app"))
        .setStats(true)
        .setScene(new THREE.Scene());

      const camera = new THREE.PerspectiveCamera();
      camera.position.set(50, 50, 50);

      engine.addEventListener("setSize", (event) => {
        camera.aspect = event.width / event.height;
        camera.updateProjectionMatrix();
      });

      const box = new THREE.Mesh(
        new THREE.BoxBufferGeometry(30, 30, 30),
        new THREE.MeshStandardMaterial()
      );

      engine.scene.add(box);

      engine.setCamera(camera).setSize().play();
    </script>
  </body>
</html>
